package com.durian.availability.service.impl;

import java.util.List;
import com.durian.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.durian.availability.mapper.RoomInfoMapper;
import com.durian.system.api.domain.availability.RoomInfo;
import com.durian.availability.service.IRoomInfoService;

/**
 * 房源Service业务层处理
 *
 * @author durian
 * @date 2022-06-22
 */
@Service
public class RoomInfoServiceImpl implements IRoomInfoService
{
    @Autowired
    private RoomInfoMapper roomInfoMapper;

    /**
     * 查询房源
     *
     * @param id 房源主键
     * @return 房源
     */
    @Override
    public RoomInfo selectRoomInfoById(String id)
    {
        return roomInfoMapper.selectRoomInfoById(id);
    }

    /**
     * 查询房源列表
     *
     * @param roomInfo 房源
     * @return 房源
     */
    @Override
    public List<RoomInfo> selectRoomInfoList(RoomInfo roomInfo)
    {
        return roomInfoMapper.selectRoomInfoList(roomInfo);
    }

    /**
     * 新增房源
     *
     * @param roomInfo 房源
     * @return 结果
     */
    @Override
    public int insertRoomInfo(RoomInfo roomInfo)
    {
        roomInfo.setCreateTime(DateUtils.getNowDate());
        return roomInfoMapper.insertRoomInfo(roomInfo);
    }

    /**
     * 修改房源
     *
     * @param roomInfo 房源
     * @return 结果
     */
    @Override
    public int updateRoomInfo(RoomInfo roomInfo)
    {
        roomInfo.setUpdateTime(DateUtils.getNowDate());
        return roomInfoMapper.updateRoomInfo(roomInfo);
    }

    /**
     * 批量删除房源
     *
     * @param ids 需要删除的房源主键
     * @return 结果
     */
    @Override
    public int deleteRoomInfoByIds(String[] ids)
    {
        return roomInfoMapper.deleteRoomInfoByIds(ids);
    }

    /**
     * 删除房源信息
     *
     * @param id 房源主键
     * @return 结果
     */
    @Override
    public int deleteRoomInfoById(String id)
    {
        return roomInfoMapper.deleteRoomInfoById(id);
    }
}
